package com.example.creditscore;

import java.util.Calendar;

import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Layout;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

public class Credit_score_form_sec_a extends Activity {
	
	private LinearLayout secALayoutEntry2;
	private LinearLayout secALayoutEntry3;
	private EditText etFacilityType2;
	private EditText etInterestRate2;
	private EditText etOutstandingLoanAmount2;
	private EditText etProposeLimit2;
	private EditText etPresentlimit2;
	private EditText etAccGrade2;
	private TextView etDateOfApplication;
	private TextView etDateOfApplication2;
	private TextView tvDateOfApplication3;
	private TextView etDateOfApplication3;
	private EditText etFacilityType3;
	private EditText etInterestRate3;
	private EditText etOutstandingLoanAmount3;
	private EditText etPresentlimit3;
	private EditText etProposeLimit3;
	private EditText etAccGrade3;
	private TextView tvEntries4;
	private TextView tvDateOfApplication4;
	private TextView etDateOfApplication4;
	private TextView tvFacilityType4;
	private EditText etFacilityType4;
	private TextView tvInterestRate4;
	private EditText etInterestRate4;
	private TextView tvOutstandingLoanAmt4;
	private EditText etOutstandingLoanAmount4;
	private TextView tvPresentLimit4;
	private EditText etPresentlimit4;
	private TextView tvProposeLimit4;
	private EditText etProposeLimit4;
	private TextView tvAccGrade4;
	private EditText etAccGrade4;
	private TextView tvEntries5;
	private TextView tvDateOfApplication5;
	private TextView etDateOfApplication5;
	private TextView tvFacilityType5;
	private EditText etFacilityType5;
	private TextView tvInterestRate5;
	private EditText etInterestRate5;
	private TextView tvOutstandingLoanAmt5;
	private EditText etOutstandingLoanAmount5;
	private TextView tvPresentLimit5;
	private EditText etPresentlimit5;
	private TextView tvProposeLimit5;
	private EditText etProposeLimit5;
	private TextView tvAccGrade5;
	private EditText etAccGrade5;
	private TextView tvEntries6;
	private TextView tvDateOfApplication6;
	private TextView etDateOfApplication6;
	private TextView tvFacilityType6;
	private EditText etFacilityType6;
	private TextView tvInterestRate6;
	private EditText etInterestRate6;
	private TextView tvOutstandingLoanAmt6;
	private EditText etOutstandingLoanAmount6;
	private TextView tvPresentLimit6;
	private EditText etPresentlimit6;
	private TextView tvProposeLimit6;
	private EditText etProposeLimit6;
	private TextView tvAccGrade6;
	private EditText etAccGrade6;
	private Button BtnAddEntries;
	private Button BtnNextPage;
	private Button BtnRmvEntries;
	private Button backPageBtn;
	private Button dateOfAppBtn;
	private Button dateOfAppBtn2;
	private Button dateOfAppBtn3;
	private Button dateOfAppBtn4;
	private Button dateOfAppBtn5;
	private Button dateOfAppBtn6;
	private int mYear;
	private int mMonth;
	private int mDay;
	// private Button mEntriesBtn;
	private int entries = 1;
	static final int DATE_DIALOG_ID = 0;
	static final int DATE_DIALOG_ID2 = 1;
	static final int DATE_DIALOG_ID3 = 2;
	static final int DATE_DIALOG_ID4 = 3;
	static final int DATE_DIALOG_ID5 = 4;
	static final int DATE_DIALOG_ID6 = 5;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_credit_score_form_sec_a);

		BtnAddEntries = (Button) findViewById(R.id.addEntriesBtn); // var for
		BtnAddEntries.setOnClickListener(addEntries()); // var for entries
														// button
														// listener
		BtnNextPage = (Button) findViewById(R.id.nextPageBtn);
		backPageBtn= (Button) findViewById(R.id.backPageBtn);
		backPageBtn.setOnClickListener(backPage());
		BtnNextPage.setOnClickListener(nextPage());
		BtnRmvEntries = (Button) findViewById(R.id.removeEntriesBtn);
		BtnRmvEntries.setOnClickListener(rmvEntries());
		etDateOfApplication2 = (TextView) findViewById(R.id.etDateofApplication2);

		etFacilityType2 = (EditText) findViewById(R.id.etFacilityType2);

		etInterestRate2 = (EditText) findViewById(R.id.etInterestRate2);

		etOutstandingLoanAmount2 = (EditText) findViewById(R.id.etOutstandingLoanAmount2);

		etProposeLimit2 = (EditText) findViewById(R.id.etProposedLimit2);
		etPresentlimit2 = (EditText) findViewById(R.id.etPresentLimit2);

		etAccGrade2 = (EditText) findViewById(R.id.etAccountGrade2);
		/*

		// tvEntries2=(TextView) findViewById(R.id.tvE)
		tvEntries2 = (TextView) findViewById(R.id.tvEntries2);
		tvDateOfApplication2 = (TextView) findViewById(R.id.tvDateOfApplication2);
		
		tvFacilityType2 = (TextView) findViewById(R.id.tvFacilityType2);
		tvInterestRate2 = (TextView) findViewById(R.id.tvInterestRate2);
		tvOutstandingLoanAmt2 = (TextView) findViewById(R.id.tvOutstandingLoanAmt2);
		tvPresentLimit2 = (TextView) findViewById(R.id.tvPresentLimit2);
		tvProposeLimit2 = (TextView) findViewById(R.id.tvProposedLimit2);
		tvAccGrade2 = (TextView) findViewById(R.id.tvAccountGrade2);*/
		
		secALayoutEntry2 = (LinearLayout) findViewById(R.id.secALayoutEntry2);
		secALayoutEntry3 = (LinearLayout) findViewById(R.id.secALayoutEntry3);
		tvDateOfApplication3 = (TextView) findViewById(R.id.tvDateOfApplication3);
		etDateOfApplication3 = (TextView) findViewById(R.id.etDateofApplication3);
		etFacilityType3 = (EditText) findViewById(R.id.etFacilityType3);
		etInterestRate3 = (EditText) findViewById(R.id.etInterestRate3);
		etOutstandingLoanAmount3 = (EditText) findViewById(R.id.etOutstandingLoanAmount3);
		etPresentlimit3 = (EditText) findViewById(R.id.etPresentLimit3);
		etProposeLimit3 = (EditText) findViewById(R.id.etProposedLimit3);
		etAccGrade3 = (EditText) findViewById(R.id.etAccountGrade3);

		tvEntries4 = (TextView) findViewById(R.id.tvEntries4);
		tvDateOfApplication4 = (TextView) findViewById(R.id.tvDateOfApplication4);
		etDateOfApplication4 = (TextView) findViewById(R.id.etDateofApplication4);
		tvFacilityType4 = (TextView) findViewById(R.id.tvFacilityType4);
		etFacilityType4 = (EditText) findViewById(R.id.etFacilityType4);
		tvInterestRate4 = (TextView) findViewById(R.id.tvInterestRate4);
		etInterestRate4 = (EditText) findViewById(R.id.etInterestRate4);
		tvOutstandingLoanAmt4 = (TextView) findViewById(R.id.tvOutstandingLoanAmt4);
		etOutstandingLoanAmount4 = (EditText) findViewById(R.id.etOutstandingLoanAmount4);
		tvPresentLimit4 = (TextView) findViewById(R.id.tvPresentLimit4);
		etPresentlimit4 = (EditText) findViewById(R.id.etPresentLimit4);
		tvProposeLimit4 = (TextView) findViewById(R.id.tvProposedLimit4);
		etProposeLimit4 = (EditText) findViewById(R.id.etProposedLimit4);
		tvAccGrade4 = (TextView) findViewById(R.id.tvAccountGrade4);
		etAccGrade4 = (EditText) findViewById(R.id.etAccountGrade4);

		tvEntries5 = (TextView) findViewById(R.id.tvEntries5);
		tvDateOfApplication5 = (TextView) findViewById(R.id.tvDateOfApplication5);
		etDateOfApplication5 = (TextView) findViewById(R.id.etDateofApplication5);
		tvFacilityType5 = (TextView) findViewById(R.id.tvFacilityType5);
		etFacilityType5 = (EditText) findViewById(R.id.etFacilityType5);
		tvInterestRate5 = (TextView) findViewById(R.id.tvInterestRate5);
		etInterestRate5 = (EditText) findViewById(R.id.etInterestRate5);
		tvOutstandingLoanAmt5 = (TextView) findViewById(R.id.tvOutstandingLoanAmt5);
		etOutstandingLoanAmount5 = (EditText) findViewById(R.id.etOutstandingLoanAmount5);
		tvPresentLimit5 = (TextView) findViewById(R.id.tvPresentLimit5);
		etPresentlimit5 = (EditText) findViewById(R.id.etPresentLimit5);
		tvProposeLimit5 = (TextView) findViewById(R.id.tvProposedLimit5);
		etProposeLimit5 = (EditText) findViewById(R.id.etProposedLimit5);
		tvAccGrade5 = (TextView) findViewById(R.id.tvAccountGrade5);
		etAccGrade5 = (EditText) findViewById(R.id.etAccountGrade5);

		tvEntries6 = (TextView) findViewById(R.id.tvEntries6);
		tvDateOfApplication6 = (TextView) findViewById(R.id.tvDateOfApplication6);
		etDateOfApplication6 = (TextView) findViewById(R.id.etDateofApplication6);
		tvFacilityType6 = (TextView) findViewById(R.id.tvFacilityType6);
		etFacilityType6 = (EditText) findViewById(R.id.etFacilityType6);
		tvInterestRate6 = (TextView) findViewById(R.id.tvInterestRate6);
		etInterestRate6 = (EditText) findViewById(R.id.etInterestRate6);
		tvOutstandingLoanAmt6 = (TextView) findViewById(R.id.tvOutstandingLoanAmt6);
		etOutstandingLoanAmount6 = (EditText) findViewById(R.id.etOutstandingLoanAmount6);
		tvPresentLimit6 = (TextView) findViewById(R.id.tvPresentLimit6);
		etPresentlimit6 = (EditText) findViewById(R.id.etPresentLimit6);
		tvProposeLimit6 = (TextView) findViewById(R.id.tvProposedLimit6);
		etProposeLimit6 = (EditText) findViewById(R.id.etProposedLimit6);
		tvAccGrade6 = (TextView) findViewById(R.id.tvAccountGrade6);
		etAccGrade6 = (EditText) findViewById(R.id.etAccountGrade6);
		backPageBtn = (Button) findViewById(R.id.backPageBtn);
		//backPageBtn.setOnClickListener(backPage());
		dateOfAppBtn = (Button) findViewById(R.id.dateOfApplicationBtn);
		dateOfAppBtn2 = (Button) findViewById(R.id.dateOfApplicationBtn2);
		dateOfAppBtn3 = (Button) findViewById(R.id.dateOfApplicationBtn3);
		dateOfAppBtn4 = (Button) findViewById(R.id.dateOfApplicationBtn4);
		dateOfAppBtn5 = (Button) findViewById(R.id.dateOfApplicationBtn5);
		dateOfAppBtn6 = (Button) findViewById(R.id.dateOfApplicationBtn6);
		dateOfAppBtn.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				showDialog(DATE_DIALOG_ID);
				// get the current date

				// display the current date (this method is below)

			}
		});

		dateOfAppBtn2.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				showDialog(DATE_DIALOG_ID2);
			}
		});

		dateOfAppBtn3.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				showDialog(DATE_DIALOG_ID3);
			}
		});

		dateOfAppBtn4.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				showDialog(DATE_DIALOG_ID4);
			}
		});

		dateOfAppBtn5.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				showDialog(DATE_DIALOG_ID5);
			}
		});

		dateOfAppBtn6.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				showDialog(DATE_DIALOG_ID6);
			}
		});
	}

	// /For Date Application Given
	@Override
	protected Dialog onCreateDialog(int id) {
		switch (id) {
		case DATE_DIALOG_ID:

			return new DatePickerDialog(this, mDateSetListener, mYear, mMonth,
					mDay);

		case DATE_DIALOG_ID2:

			return new DatePickerDialog(this, mDateSetListener2, mYear, mMonth,
					mDay);
		case DATE_DIALOG_ID3:

			return new DatePickerDialog(this, mDateSetListener3, mYear, mMonth,
					mDay);
		case DATE_DIALOG_ID4:

			return new DatePickerDialog(this, mDateSetListener4, mYear, mMonth,
					mDay);
		case DATE_DIALOG_ID5:

			return new DatePickerDialog(this, mDateSetListener5, mYear, mMonth,
					mDay);
		case DATE_DIALOG_ID6:

			return new DatePickerDialog(this, mDateSetListener6, mYear, mMonth,
					mDay);
		}
		return null;
	}

	// the callback receive when the user "sets" the date in the dialog
	/**
	 * @uml.property name="mDateSetListener"
	 * @uml.associationEnd multiplicity="(1 1)"
	 */
	private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {

		public void onDateSet(DatePicker view, int year, int monthOfYear,
				int dayOfMonth) {

			// get the current date
			final Calendar c = Calendar.getInstance();
			mYear = year;
			mMonth = monthOfYear;
			mDay = dayOfMonth;
			updateDisplay();

		}

	};

	// updates the dates in the textView
	private void updateDisplay() {
		etDateOfApplication.setText(new StringBuilder()
				// month is 0 base so add 1
				.append(mMonth + 1).append("-").append(mDay).append("-")
				.append(mYear).append(" "));
	}

	// the callback receive when the user "sets" the date in the dialog
	/**
	 * @uml.property name="mDateSetListener2"
	 * @uml.associationEnd multiplicity="(1 1)"
	 */
	private DatePickerDialog.OnDateSetListener mDateSetListener2 = new DatePickerDialog.OnDateSetListener() {

		public void onDateSet(DatePicker view, int year, int monthOfYear,
				int dayOfMonth) {

			// get the current date
			final Calendar c = Calendar.getInstance();
			mYear = year;
			mMonth = monthOfYear;
			mDay = dayOfMonth;
			updateDisplay2();

		}

	};

	// updates the dates in the textView
	private void updateDisplay2() {
		etDateOfApplication2.setText(new StringBuilder()
				// month is 0 base so add 1
				.append(mMonth + 1).append("-").append(mDay).append("-")
				.append(mYear).append(" "));
	}

	// the callback receive when the user "sets" the date in the dialog
	/**
	 * @uml.property name="mDateSetListener3"
	 * @uml.associationEnd multiplicity="(1 1)"
	 */
	private DatePickerDialog.OnDateSetListener mDateSetListener3 = new DatePickerDialog.OnDateSetListener() {

		public void onDateSet(DatePicker view, int year, int monthOfYear,
				int dayOfMonth) {

			// get the current date
			final Calendar c = Calendar.getInstance();
			mYear = year;
			mMonth = monthOfYear;
			mDay = dayOfMonth;
			updateDisplay3();

		}

	};

	// updates the dates in the textView
	private void updateDisplay3() {
		etDateOfApplication3.setText(new StringBuilder()
				// month is 0 base so add 1
				.append(mMonth + 1).append("-").append(mDay).append("-")
				.append(mYear).append(" "));
	}

	// the callback receive when the user "sets" the date in the dialog
	/**
	 * @uml.property name="mDateSetListener4"
	 * @uml.associationEnd multiplicity="(1 1)"
	 */
	private DatePickerDialog.OnDateSetListener mDateSetListener4 = new DatePickerDialog.OnDateSetListener() {

		public void onDateSet(DatePicker view, int year, int monthOfYear,
				int dayOfMonth) {

			// get the current date
			final Calendar c = Calendar.getInstance();
			mYear = year;
			mMonth = monthOfYear;
			mDay = dayOfMonth;
			updateDisplay4();

		}

	};

	// updates the dates in the textView
	private void updateDisplay4() {
		etDateOfApplication4.setText(new StringBuilder()
				// month is 0 base so add 1
				.append(mMonth + 1).append("-").append(mDay).append("-")
				.append(mYear).append(" "));
	}

	// the callback receive when the user "sets" the date in the dialog
	/**
	 * @uml.property name="mDateSetListener5"
	 * @uml.associationEnd multiplicity="(1 1)"
	 */
	private DatePickerDialog.OnDateSetListener mDateSetListener5 = new DatePickerDialog.OnDateSetListener() {

		public void onDateSet(DatePicker view, int year, int monthOfYear,
				int dayOfMonth) {

			// get the current date
			final Calendar c = Calendar.getInstance();
			mYear = year;
			mMonth = monthOfYear;
			mDay = dayOfMonth;
			updateDisplay5();

		}

	};

	// updates the dates in the textView
	private void updateDisplay5() {
		etDateOfApplication5.setText(new StringBuilder()
				// month is 0 base so add 1
				.append(mMonth + 1).append("-").append(mDay).append("-")
				.append(mYear).append(" "));
	}

	// the callback receive when the user "sets" the date in the dialog
	/**
	 * @uml.property name="mDateSetListener6"
	 * @uml.associationEnd multiplicity="(1 1)"
	 */
	private DatePickerDialog.OnDateSetListener mDateSetListener6 = new DatePickerDialog.OnDateSetListener() {

		public void onDateSet(DatePicker view, int year, int monthOfYear,
				int dayOfMonth) {

			// get the current date
			final Calendar c = Calendar.getInstance();
			mYear = year;
			mMonth = monthOfYear;
			mDay = dayOfMonth;
			updateDisplay6();

		}

	};

	// updates the dates in the textView
	private void updateDisplay6() {
		etDateOfApplication6.setText(new StringBuilder()
				// month is 0 base so add 1
				.append(mMonth + 1).append("-").append(mDay).append("-")
				.append(mYear).append(" "));
	}

	private OnClickListener addEntries() {
		return new OnClickListener() {
			public void onClick(View v) {
				System.out.println("onclick ");
				if (entries < 6) {
					if (entries == 1) {
						secALayoutEntry2.setVisibility(View.VISIBLE);
						etDateOfApplication2.setVisibility(View.VISIBLE);
						
						BtnRmvEntries.setVisibility(View.VISIBLE);
						dateOfAppBtn2.setVisibility(View.VISIBLE);

						System.out.println("entries " + entries);
					}

					if (entries == 2) {
						System.out.println("entries2 " + entries);
						
						dateOfAppBtn3.setVisibility(View.VISIBLE);
						secALayoutEntry3.setVisibility(View.VISIBLE);

					}

					if (entries == 3) {
						System.out.println("entries3 " + entries);
						tvEntries4.setVisibility(View.VISIBLE);
						tvDateOfApplication4.setVisibility(View.VISIBLE);
						etDateOfApplication4.setVisibility(View.VISIBLE);
						tvFacilityType4.setVisibility(View.VISIBLE);
						etFacilityType4.setVisibility(View.VISIBLE);
						tvInterestRate4.setVisibility(View.VISIBLE);
						etInterestRate4.setVisibility(View.VISIBLE);
						tvOutstandingLoanAmt4.setVisibility(View.VISIBLE);
						etOutstandingLoanAmount4.setVisibility(View.VISIBLE);
						tvPresentLimit4.setVisibility(View.VISIBLE);
						etPresentlimit4.setVisibility(View.VISIBLE);
						tvProposeLimit4.setVisibility(View.VISIBLE);
						etProposeLimit4.setVisibility(View.VISIBLE);
						tvAccGrade4.setVisibility(View.VISIBLE);
						etAccGrade4.setVisibility(View.VISIBLE);
						BtnAddEntries.setVisibility(View.VISIBLE);
						dateOfAppBtn4.setVisibility(View.VISIBLE);
					}

					if (entries == 4) {

						tvEntries5.setVisibility(View.VISIBLE);
						tvDateOfApplication5.setVisibility(View.VISIBLE);
						etDateOfApplication5.setVisibility(View.VISIBLE);
						tvFacilityType5.setVisibility(View.VISIBLE);
						etFacilityType5.setVisibility(View.VISIBLE);
						tvInterestRate5.setVisibility(View.VISIBLE);
						etInterestRate5.setVisibility(View.VISIBLE);
						tvOutstandingLoanAmt5.setVisibility(View.VISIBLE);
						etOutstandingLoanAmount5.setVisibility(View.VISIBLE);
						tvPresentLimit5.setVisibility(View.VISIBLE);
						etPresentlimit5.setVisibility(View.VISIBLE);
						tvProposeLimit5.setVisibility(View.VISIBLE);
						etProposeLimit5.setVisibility(View.VISIBLE);
						tvAccGrade5.setVisibility(View.VISIBLE);
						etAccGrade5.setVisibility(View.VISIBLE);
						BtnAddEntries.setVisibility(View.VISIBLE);
						dateOfAppBtn5.setVisibility(View.VISIBLE);

					}

					if (entries == 5) {

						tvEntries6.setVisibility(View.VISIBLE);
						tvDateOfApplication6.setVisibility(View.VISIBLE);
						etDateOfApplication6.setVisibility(View.VISIBLE);
						tvFacilityType6.setVisibility(View.VISIBLE);
						etFacilityType6.setVisibility(View.VISIBLE);
						tvInterestRate6.setVisibility(View.VISIBLE);
						etInterestRate6.setVisibility(View.VISIBLE);
						tvOutstandingLoanAmt6.setVisibility(View.VISIBLE);
						etOutstandingLoanAmount6.setVisibility(View.VISIBLE);
						tvPresentLimit6.setVisibility(View.VISIBLE);
						etPresentlimit6.setVisibility(View.VISIBLE);
						tvProposeLimit6.setVisibility(View.VISIBLE);
						etProposeLimit6.setVisibility(View.VISIBLE);
						tvAccGrade6.setVisibility(View.VISIBLE);
						etAccGrade6.setVisibility(View.VISIBLE);
						BtnAddEntries.setVisibility(View.INVISIBLE);
						dateOfAppBtn6.setVisibility(View.VISIBLE);

					}
					entries++;

				}
			}
		};
	}

	private OnClickListener rmvEntries() {
		return new OnClickListener() {
			public void onClick(View v) {

				if (entries == 2) {
					secALayoutEntry2.setVisibility(View.GONE);
					etDateOfApplication2.setVisibility(View.GONE);
					
					BtnRmvEntries.setVisibility(View.INVISIBLE);
					BtnAddEntries.setVisibility(View.VISIBLE);
					dateOfAppBtn2.setVisibility(View.GONE);

				}

				if (entries == 3) {
					
					BtnAddEntries.setVisibility(View.VISIBLE);
					dateOfAppBtn3.setVisibility(View.GONE);
					secALayoutEntry3.setVisibility(View.GONE);
				}

				if (entries == 4) {
					tvEntries4.setVisibility(View.GONE);
					tvDateOfApplication4.setVisibility(View.GONE);
					etDateOfApplication4.setVisibility(View.GONE);
					tvFacilityType4.setVisibility(View.GONE);
					etFacilityType4.setVisibility(View.GONE);
					tvInterestRate4.setVisibility(View.GONE);
					etInterestRate4.setVisibility(View.GONE);
					tvOutstandingLoanAmt4.setVisibility(View.GONE);
					etOutstandingLoanAmount4.setVisibility(View.GONE);
					tvPresentLimit4.setVisibility(View.GONE);
					etPresentlimit4.setVisibility(View.GONE);
					tvProposeLimit4.setVisibility(View.GONE);
					etProposeLimit4.setVisibility(View.GONE);
					tvAccGrade4.setVisibility(View.GONE);
					etAccGrade4.setVisibility(View.GONE);
					BtnAddEntries.setVisibility(View.VISIBLE);
					dateOfAppBtn4.setVisibility(View.GONE);

				}

				if (entries == 5) {
					tvEntries5.setVisibility(View.GONE);
					tvDateOfApplication5.setVisibility(View.GONE);
					etDateOfApplication5.setVisibility(View.GONE);
					tvFacilityType5.setVisibility(View.GONE);
					etFacilityType5.setVisibility(View.GONE);
					tvInterestRate5.setVisibility(View.GONE);
					etInterestRate5.setVisibility(View.GONE);
					tvOutstandingLoanAmt5.setVisibility(View.GONE);
					etOutstandingLoanAmount5.setVisibility(View.GONE);
					tvPresentLimit5.setVisibility(View.GONE);
					etPresentlimit5.setVisibility(View.GONE);
					tvProposeLimit5.setVisibility(View.GONE);
					etProposeLimit5.setVisibility(View.GONE);
					tvAccGrade5.setVisibility(View.GONE);
					etAccGrade5.setVisibility(View.GONE);
					BtnAddEntries.setVisibility(View.VISIBLE);
					dateOfAppBtn5.setVisibility(View.GONE);

				}

				if (entries == 6) {
					tvEntries6.setVisibility(View.GONE);
					tvDateOfApplication6.setVisibility(View.GONE);
					etDateOfApplication6.setVisibility(View.GONE);
					tvFacilityType6.setVisibility(View.GONE);
					etFacilityType6.setVisibility(View.GONE);
					tvInterestRate6.setVisibility(View.GONE);
					etInterestRate6.setVisibility(View.GONE);
					tvOutstandingLoanAmt6.setVisibility(View.GONE);
					etOutstandingLoanAmount6.setVisibility(View.GONE);
					tvPresentLimit6.setVisibility(View.GONE);
					etPresentlimit6.setVisibility(View.GONE);
					tvProposeLimit6.setVisibility(View.GONE);
					etProposeLimit6.setVisibility(View.GONE);
					tvAccGrade6.setVisibility(View.GONE);
					etAccGrade6.setVisibility(View.GONE);
					BtnAddEntries.setVisibility(View.VISIBLE);
					dateOfAppBtn6.setVisibility(View.GONE);

				}
				entries--;

			}
		};
	}

	private OnClickListener nextPage() {
		final Context context = this;
		return new OnClickListener() {
			public void onClick(View v) {

				Intent intent = new Intent(context,
						Credit_score_form_sec_b.class);
				startActivity(intent);

			}
		};
	}

	/*private OnClickListener backPage() {
		final Context context = this;
		return new OnClickListener() {
			public void onClick(View v) {

				Intent intent = new Intent(context, DisplayPolicy.class);
				startActivity(intent);

			}
		};
	}*/
	
	private OnClickListener backPage() {
		final Context context = this;
		return new OnClickListener() {
			public void onClick(View v) {
				
				
				 Intent intent = new Intent(context, Credit_score_client_listView.class);
                 startActivity(intent); 
                 
			}
		};
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_credit_score_form, menu);
		return true;
	}
}
